<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>表单绑定</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div class="box">
        <input type="text" v-model="msg">
        <textarea v-model='msg' name="" id="" cols="30" rows="10"></textarea>
        <br>
        <!-- 当有一个多选框的时候 初始值可以设计为布尔值 -->
        <input type="checkbox" v-model="check"><br>

        <!-- 当有多个多选框的时候 初始值设置为数组 -->
        <label for="zuqiu">足球</label>
        <input type="checkbox" name="hobby" id="zuqiu" v-model="checkArr" value="足球">

        <label for="lanqiu">篮球</label>
        <input type="checkbox" name="hobby" id="lanqiu" v-model="checkArr" value="篮球">
        <hr>
        <h1>{{checkArr}}</h1>

        <!-- 单选框 -->
        <label for="nan">男</label>
        <input type="radio" name="sex" id="nan" value="男" v-model="radioValue">
        <label for="nv">女</label>
        <input type="radio" name="sex" id="nv" value="女" v-model="radioValue">
        <h1>{{radioValue}}</h1>
    </div>
    <script>
        let vm = new Vue({
            el:'.box',
            data:{
                msg:'对于input框type为text 有值写值 没值就写空串',
                check:false,
                checkArr:[],//数组中收集的是选中后的value值
                radioValue:''
            },

        })
    </script>
</body>
</html>